home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group99a.txt / 000142_icon-group-sender _Tue Jun 22 12:33:06 1999.msg < prev    next >
Internet Message Format  |  2000-09-20  |  1KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id MAA01037
  4.     for icon-group-addresses; Tue, 22 Jun 1999 12:32:55 -0700 (MST)
  5. Message-Id: <199906221932.MAA01037@baskerville.CS.Arizona.EDU>
  6. From: dgamey@ca.ibm.com
  7. X-Lotus-FromDomain: IBMCA@IBMUS
  8. To: Kostas Oikonomou <oikonomou@att.com>
  9. cc: icon-group@optima.CS.Arizona.EDU
  10. Date: Tue, 22 Jun 1999 13:41:34 -0400
  11. Subject: Re: Assertions in Icon
  12. Content-Disposition: inline
  13. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  14. Status: RO
  15.  
  16.  
  17.  
  18. >Does anyone have a suggestion about how to implement a procedure "assert",
  19. >which, when called with an expression "e" as argument, implements
  20. >
  21. >         e | stop("Assertion on line ", &line, " failed!")
  22. >
  23. >Here &line should be the line on which assert(e) appears.
  24.  
  25.  
  26. I don't think there is a way to get your callers &line, unless you provide it as
  27. a parameter to each call.  There may be some other possibilities but they seem
  28. messy to me.
  29.  
  30. Another route is to use runerr() instead of stop which will cause a program
  31. termination with a traceback.   Not as pretty but serviceable.
  32.  
  33. Hope that helps.
  34.  
  35. David
  36.  
  37.  
  38.